package com.yy.controller.mapper;

import com.yy.entity.OrderDetail;
import com.yy.entity.ShoppingCart;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface OrderDetailMapper {

    /**
     * 根据订单id查询订单详情
     * @param orderId
     * @return
     */
    @Select("select * from order_detail where order_id = #{orderId}")
    List<OrderDetail> getListByOrderId(Long orderId);

    /**
     * 填加到订单详情
     * @param shoppingCart
     */
    @Insert("insert into order_detail ( name, image, order_id, " +
            "dish_id, setmeal_id, number, amount) values " +
            "(#{name},#{image},#{orderId},#{dishId},#{setmealId}," +
            "#{number},#{amount})")
    void add(ShoppingCart shoppingCart);
}
